﻿using System.Windows;
using System.Windows.Media;

namespace GraphLight.Controls
{
    public static class DependecyObjectExtensions
    {
        public static T GetParent<T>(this DependencyObject obj) where T : class
        {
            var parent = obj;
            do
                parent = VisualTreeHelper.GetParent(parent);
            while (parent != null && !(parent is T));
            return parent as T;
        }
    }
}
